<?php

class AdminGroupController extends AdminBaseController {
	public function add(){
		if (!empty($_GET['id'])){
			$data  = HttpDaoManager::getAdminGroupDao()->get($_GET['id']);
			$data['permissions_functoin'] =explode(',',$data['permissions_functoin']);
		}
		$data['id'] = isset($data['id'])?$data['id']:Common::getGetStrValue('id');
		$data['function'] =  HttpServerManager::getFunctionServer()->infiniteClass(array('id'=>0));
		return $data;
	}
	public function subAdd(){
		$data = $_POST;
		if (count($data['permissions_functoin'])>=1){
			$data['permissions_functoin'] = implode(',',$data['permissions_functoin']);
		}
		$data['code']= strtoupper($data['code']);
		HttpDaoManager::getAdminGroupDao()->add($data);
		ClassManager::getToos()->msgbox("添加成功");
	}
	public function subUpdate(){
		$data = $_POST;
		if (count($data['permissions_functoin'])>=1){
			$data['permissions_functoin'] = implode(',',$data['permissions_functoin']);
		}
		HttpDaoManager::getAdminGroupDao()->update($data, $_POST['id']);
		ClassManager::getToos()->msgbox("修改成功","adminGroup_lists.html");
	}
	public function lists(){
		return HttpServerManager::getAdminGroupServer()->paging();
	}
	public function delete(){
		HttpServerManager::getAdminGroupServer()->deleteBatchByid($_GET['id']);
		ClassManager::getToos()->msgbox("删除成功");
	}
}

?>